﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Wizard.Controls
{
    public partial class EtchedLine : UserControl
    {
        private Color p_DarkColor = SystemColors.ControlDark;
        private Color p_LightColor = SystemColors.ControlLightLight;

        public EtchedLine()
        {
            InitializeComponent();

            // Avoid receiving the focus.
            SetStyle(ControlStyles.Selectable, false);
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Pen light = new Pen(new SolidBrush(this.p_LightColor), 1);
            Pen dark = new Pen(new SolidBrush(this.p_DarkColor), 1);

            e.Graphics.DrawLine(dark, 0, 0, this.Width, 0);
            e.Graphics.DrawLine(light, 0, 1, this.Width, 1);
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            Refresh();
        }

        [Category("Appearance")]
        public Color DarkColor
        {
            get
            {
                return this.p_DarkColor;
            }
            set
            {
                this.p_DarkColor = value;
                Refresh();
            }
        }

        [Category("Appearance")]
        public Color LightColor
        {
            get
            {
                return this.p_LightColor;
            }
            set
            {
                this.p_LightColor = value;
                Refresh();
            }
        }
    }
}
